import yaml

from config.setting import Configure


class YamlHandler():
    def __init__(self, file):
        self.file = file

    def read(self, encoding="utf8"):
        f = open(self.file, encoding=encoding)
        # todo 参数可以是f或f。read（）
        data = yaml.load(f, yaml.FullLoader)
        f.close()
        return data


# 可以用同一个对象的话，直接实例化就可以了
yaml_data = YamlHandler(Configure.yaml_path).read()

if __name__ == '__main__':
    print(yaml_data)